package figuren;

import java.util.ArrayList;
import java.util.List;

public class Rechteck extends Figur
{
	int		a;			// waagerecht
	int		b;			// senkrecht
	Point	zentrum;

	public Rechteck(int a, int b, Point zentrum)
	{
		this.a = a;
		this.b = b;
		this.zentrum = zentrum;
		this.aussenLinie = this.berechneEcken();
	}

	public List<Point> berechneEcken()
	{
		Point c = new Point(this.zentrum.getX() - this.a / 2, this.zentrum.getY() - this.b / 2);
		Point d = new Point(this.zentrum.getX() + this.a / 2, this.zentrum.getY() - this.b / 2);
		Point e = new Point(this.zentrum.getX() + this.a / 2, this.zentrum.getY() + this.b / 2);
		Point f = new Point(this.zentrum.getX() - this.a / 2, this.zentrum.getY() + this.b / 2);
		List<Point> ecken = new ArrayList<Point>();
		ecken.add(c);
		ecken.add(d);
		ecken.add(e);
		ecken.add(f);
		ecken.add(c);
		return ecken;
	}

	public double inhalt()
	{

		return (this.a * this.b);
	}

	public double umfang()
	{

		return ((this.a * 2) + (this.b * 2));
	}

}
